<!-- 四六级成绩单的修改 -->
<template>
    <div>
        <el-dialog :title="params.isEdit?'修改':'手动录入'" :visible.sync="windowVisible" width="1200px" :close-on-click-modal="false">
            <div class="my-form-container" style="height:522px;width: 1000px;">
                <el-form ref="dataForm" :model="dataForm" class="demo-ruleForm">
                    <el-row class="my-form-item">
                        <el-col :span="12">
                           <div class="my-form-item-label">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名</div>
							<div class="my-form-item-value">
								<div style="display:flex;align-items:center" v-if="!params.isEdit">
									<el-input class="inputWidth" v-model="dataForm.studentName" disabled style="width:100px"></el-input>
									<span class="small-btn edit-green" @click="choseDialog">
										<img src="../../../assets/assessment/icon-plan-record-detail.png"> 选择
									</span>
								</div>
							</div>
                        </el-col>
                        <el-col :span="12">
                            <div class="my-form-item-label">性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别</div>
                            <div class="my-form-item-value">{{dataForm.gender}}</div>
                        </el-col>
                    </el-row>
                    <el-row class="my-form-item">
                        <el-col :span="12">
                            <div class="my-form-item-label">院&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;系</div>
                            <div class="my-form-item-value">{{dataForm.dept}}</div>
                        </el-col>
                        <el-col :span="12">
                            <div class="my-form-item-label">专业班次</div>
                            <div class="my-form-item-value">{{dataForm.className}}</div>
                        </el-col>
                    </el-row>
                    <el-row class="my-form-item">
                        <el-col :span="12">
                            <div class="my-form-item-label">学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</div>
                            <div class="my-form-item-value">{{dataForm.studentCode}}</div>
                        </el-col>
                        <el-col :span="12">
                            <div class="my-form-item-label">准考证号</div>
                            <el-form-item  prop="examNumber">
                                <div class="my-form-item-value">
                                    <el-input class="inputWidth" v-model="dataForm.examNumber"></el-input>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row class="my-form-item">
                        <el-col :span="24">
                            <div class="my-form-item-label">成绩单号</div>
                            <el-form-item  prop="reportNumber">
                                <div class="my-form-item-value">
                                    <el-input class="inputWidth" v-model="dataForm.reportNumber"></el-input>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row class="my-form-item">
                        <el-col :span="12">
                            <div class="my-form-item-label">总分</div>
                            <el-form-item  prop="totalPoints">
                                <div class="my-form-item-value">
                                    <el-input class="inputWidth" v-model="dataForm.totalPoints"></el-input>
                                </div>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <div class="my-form-item-label">听力</div>
                            <el-form-item  prop="hearing">
                                <div class="my-form-item-value">
                                    <el-input class="inputWidth" v-model="dataForm.hearing"></el-input>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row class="my-form-item">
                        <el-col :span="12">
                            <div class="my-form-item-label">阅读</div>
                            <el-form-item  prop="reading">
                                <div class="my-form-item-value">
                                    <el-input class="inputWidth" v-model="dataForm.reading"></el-input>
                                </div>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <div class="my-form-item-label">综合</div>
                            <el-form-item  prop="synthesis">
                                <div class="my-form-item-value">
                                    <el-input class="inputWidth" v-model="dataForm.synthesis"></el-input>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row class="my-form-item">
                        <el-col :span="12">
                            <div class="my-form-item-label">作文</div>
                            <el-form-item  prop="writing">
                                <div class="my-form-item-value">
                                    <el-input class="inputWidth" v-model="dataForm.writing"></el-input>
                                </div>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <div class="my-form-item-label">口语</div>
                            <el-form-item  prop="speaking">
                                <div class="my-form-item-value">
                                    <el-input class="inputWidth" v-model="dataForm.speaking"></el-input>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row class="my-form-item" style="border:none;height: 100px;">
                        <el-col :span="24">
                            <div class="my-form-item-label">备注</div>
                            <el-form-item  prop="scoreRemark">
                                <div class="my-form-item-value assessment-design" style="line-height:88px">
                                    <el-input type="textarea" style="width: 400px;" :rows="3" v-model="dataForm.scoreRemark"></el-input>
                                </div>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
            </div>
            <div class="button-group">
                <div @click="saveEdit">保存</div>
                <div @click="windowVisible=false">取消</div>
            </div>
        </el-dialog>
        <ChoseStudent ref="choseDialog" ></ChoseStudent>
    </div>
</template>
<script>
import {saveCETExam,saveEditCETExam,cetDetail} from "@/api/exam";
import ChoseStudent from '@/components/choseStudent';

export default {
  data() {
    return {
      windowVisible:false,
      dataForm:{
        studentName:'',//学员姓名
        studentCode:'',//学号
		idCard:'',//身份证号
		gender:'',//性别
		dept:'',//院系
		className:'',//专业班次
        examNumber:'',//转考证号
        reportNumber:'',//成绩单号
		totalPoints:'',//总分
        hearing:'',//听力
        reading:'',//阅读
        synthesis:'',//综合
		writing:'',//作文
        speaking:'',//口语
		scoreRemark:'',//备注
        id:''
      },
    };
  },
  props:{
	params:{
		default:()=>{},
	}
  },
  windowVisible(val){
    if(val && this.dataForm.id == ''){
        Object.assign(this.dataForm,this.$options.data().dataForm)
    }
  },
  components: {ChoseStudent},
  mounted(){
    if(this.dataForm.id){
        this.getDetail()
    }
  },
  methods: {
    choseDialog(){
        this.$refs.choseDialog.dialogVisible = true
    },
    async getDetail(){
        let res = await cetDetail({scoreId:this.dataForm.id});
        if(res.code == 200){
            this.dataForm = res.data
        }
    },
    async saveEdit(){
        let res ;
        if(this.dataForm.id){
            res = await saveEditCETExam(this.dataForm);
        }else{
            res = await saveCETExam(this.dataForm);
        }
        if(res.code == 200){
            this.windowVisible = false;
            this.$emit('saveEdit')
        }
    }
  },
};
</script>

<style lang="less" scoped>
@import "../../../styles/commonCss.less";
.my-form-container .my-form-item > div .my-form-item-label{width: 200px;padding-left: 0;justify-content: center;}
.button-group{
    padding-bottom: 56px;
}
.assessment-design {
    .el-textarea__inner {
        resize: none;
        font-size: 16px;
        color: rgba(0, 76, 167, 1);
    }
}
.edit-green{
    background: #F1FFF8;
    border: 1px solid #02C86C;
    color: #02C86C;
	width: 82px;
	height: 27px;
	font-size: 14px;
	margin-left: 10px;
}
</style>
